﻿namespace calendar.Model
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using calendar.App_Data;
    using System.Data.SqlClient; 

    class Logic
    {
        public CalendarDataSet db;
        public AddEeventDataSet db2;
        public Logic()
        {
            db = new CalendarDataSet();
            db2 = new AddEeventDataSet();
        }
        

        public bool CheckUser(string userName, string pw) 
        {
            ////////////////////////////

            string condition = "UserName = '" + userName + "' AND UserPassword = '" + pw + "'";
            int count = db.Calendar_User.Select(condition).Count();

            // Require  (Count != NULL) ;
             
            if (count == 0)
            {
                return false;
            }
            else
            {
                return true ;
            }
            // Invariant (Passwod and user name didn't change) ;
        }

        public void AddEvent(string eventName, string eventDate)
        {

            // Require eventname != NULL  
            string eventNAME, eventDATE;
            // 
           
            
    }
}
